﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Acme
{
    public abstract class rodent: IMouseModel
    {
        private string mName;
        private string mHairColor;
        private int mTotalFoodEaten;
        private int mMaxFeed;
        private string mStatus;

        public event ModelUpdateDelegate ModelUpdated;


        public rodent(string pName, string pHairColor, int pMaxFeed)
        {
            this.mName = pName;
            this.mHairColor = pHairColor;
            this.mMaxFeed = pMaxFeed;
            this.mStatus = "Hungry";
        }

        public string Name
        {
            get { return this.mName; }
            set { this.mName = value; }
        }

        public string HairColor
        {
            get { return this.mHairColor; }
        }

        public string Status
        {
            get { return this.mStatus; }
        }

        public int TotalFoodEaten
        {
            get { return this.mTotalFoodEaten; }
        }

        public int MaxFeed
        {
            get { return this.mMaxFeed; }
        }

        public void Feed(int pAmount)
        {
            this.mTotalFoodEaten += pAmount;
            if (this.mTotalFoodEaten >= this.mMaxFeed)
                this.mStatus = "Full";
            this.ModelUpdated(this);
        }

        public void UpdateListeners()
        {
            this.ModelUpdated(this);
        }
    }
}
